$("#loginBtn").click(function () {
  let username = $("#username").val(), // 用户名
    password = $("#password").val(), // 密码
    remember = $("#remember").is(":checked") ? "on" : "";
  if (!username || !username.trim()) {
    mui.alert($("#username").attr("placeholder"));
  } else if (!password || !password.trim()) {
    mui.alert($("#password").attr("placeholder"));
  } else {
    let user = {
      username: username,
      password: password,
      remember: remember,
    };
    var res = playPost("/login", "", JSON.stringify(user));
    if (res.code == 200) {
      window.localStorage.setItem("userInfo", JSON.stringify(res.userInfo));
      window.localStorage.setItem("token", res.token);
      location.href = "index2.html";
    } else {
      mui.alert(res.msg);
    }
  }
});
